/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mvp.levelup.files;

import java.util.StringTokenizer;

/**
 *
 * @author WORKSPOT2
 */
public class Book
{

    private int id;
    private String name;
    private String author;

    public Book(int id, String name, String author)
    {
        this.id = id;
        this.name = name;
        this.author = author;
    }
    
    public Book(String fromFile)
    {
        StringTokenizer tokenizer = new StringTokenizer(fromFile,"|");
        this.id = Integer.parseInt(tokenizer.nextToken());
        this.name = tokenizer.nextToken();
        this.author = tokenizer.nextToken();
    }

    public int getId()
    {
        return id;
    }

    public String getName()
    {
        return name;
    }

    public String getAuthor()
    {
        return author;
    }

    @Override
    public String toString()
    {
        return id + "|" + name + "|" + author;
    }
    
}
